package com.sys.app.cms;

import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
 
public class OnRegistered {
	static public void saveOnRegistered(String onid, String token, Context context) {
		SharedPreferences sharedPreferences = context.getSharedPreferences("cookie", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPreferences.edit();
        
        editor.putString("onid", onid);
        editor.putString("token", token);
        editor.commit();
	}
	
	static public String getOnId(Context context) { 
		SharedPreferences sharedPreferences = context.getSharedPreferences("cookie", Context.MODE_PRIVATE);
		return sharedPreferences.getString("onid", "");
	}
	
	static public String getToken(Context context) {
		SharedPreferences sharedPreferences = context.getSharedPreferences("cookie", Context.MODE_PRIVATE);
		return sharedPreferences.getString("token", "");
	}
	
	static public boolean haveOnIdToken(Context context) {
		if(TextUtils.isEmpty(getOnId(context)) || TextUtils.isEmpty(getToken(context))) {
			return false;
		} else {
			return true;
		}
	}

}
